-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli/sql: new parameter --watch to repeat the -e statements #40594
Conversation
Release note (cli change): `cockroach sql` now supports the `--watch` command line parameter. When used to specified a duration, the client will repeat the statement(s) specified by `-e` until an error occurs. This is intended for simple monitoring scenarios during development and testing.
6a5f9bf
to
dea2a03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM.
However I am forced to compare this to my own PR #40453 where I also did things to our cli in order to assist in my own testing. You were opposed to that, suggesting I write a custom command to do it. Is there a reason this PR should be accepted and mine should not? To me both appear to be "let's make something a bit weirder so we can test better".
I was waiting for you to ask precisely this question and that's also why I chose you as reviewer :-)
I don't know, what do you think?
My reasoning is the same here as there: the interactive shell is human oriented and that's why I am not touching it. Initially I thought of supporting \watch like in psql but I could not find a way to integrate this in a way that would guarantee stable output, so that's why I'm restricting the functionality to processing -e, which we did design to be automatable.
Let me know what you think
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
I think you should just go ahead and merge this PR because it's useful. But I'm not convinced that our line of merging things that are useful for testing should be at the interactive shell. Seems kinda arbitrary. Maybe it should? Maybe my PR could solve its problem in a different way that doesn't involve changing anything on the interactive side? |
I think my line of thinking remains the following:
|
Not really weighing in here but couldn't you use the Linux |
@jordanlewis |
bors r+ |
Build failed (retrying...) |
40594: cli/sql: new parameter --watch to repeat the -e statements r=knz a=knz Release justification: needed in tests I found myself needing this for scenario-based testing. The importance of this compared to enclosing `cockroach sql` in a shell loop is that I want/need to avoid the overhead of establishing a new SQL connection each time. It would greatly simplify my workflow to have this on `master` ASAP, but if the TL in charge thinks "too late" I'll accept (a little reluctantly) delaying until the branch is cut. Co-authored-by: Raphael 'kena' Poss <[email protected]>
Build succeeded |
Release justification: needed in tests
I found myself needing this for scenario-based testing.
The importance of this compared to enclosing
cockroach sql
in a shell loop is that I want/need to avoid the overhead of establishing a new SQL connection each time.It would greatly simplify my workflow to have this on
master
ASAP, but if the TL in charge thinks "too late" I'll accept (a little reluctantly) delaying until the branch is cut.